#ifndef POST_PROCESS_VARIABLE_H
#define POST_PROCESS_VARIABLE_H

#include <algorithm>
#include <array>
#include <boost/foreach.hpp>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <eigen3/Eigen/Core>
#include <eigen3/Eigen/Dense>
#include <memory>

#include "common/perception_defs.h"

struct Box {
  /// @brief Center
  Eigen::Vector3f center;
  /// @brief length
  float length;
  /// @brief width
  float width;
  /// @brief height
  float height;
  /// @brief polygon
  std::array<Eigen::Vector3f, 4> polygon;
};

namespace bg = boost::geometry;
using TrackedObjectPtr = std::shared_ptr<TrackedObject>;
using point_t = bg::model::d2::point_xy<float>;
using polygon_t = bg::model::polygon<point_t>;

class PostProcessCommon {
 public:
  PostProcessCommon();
  PostProcessCommon(PostProcessCommon const &) = delete;  // 不允许拷贝构造函数
  PostProcessCommon &operator=(PostProcessCommon const &) =
      delete;  // 不允许赋值运算符重载
  PostProcessCommon(PostProcessCommon &&) = delete;  // 不允许左值传递
  PostProcessCommon &operator=(PostProcessCommon &&) =
      delete;  // 不允许重载地址传递的运算符
  ~PostProcessCommon();

  /// @brief calculate iou 2d with two boxes, intersection/union
  /// @param b1 box1
  /// @param b2 box2
  /// @return float  iou 2d value
  static float Iou2D(const Box &b1, const Box &b2);

  /// @brief calculate giou 2d with two boxes,
  /// intersection/union-(convex hull-union)/(convex hull)
  /// @param b1 box1
  /// @param b2 box2
  /// @return float  iou 2d value
  static float Giou2D(const Box &b1, const Box &b2);
};

#endif
